<template>
  <div class="ppp">
    <h2>姓名:{{name}}</h2>
    <h2>性别:{{sex}}</h2>
    <button @click="sengName">把姓名给game组件</button>
  </div>
</template>

<script>
import pubsub from 'pubsub-js'
export default {
    name:'Person',
    data(){
        return{
            name:'陆沉',
            sex:'男',
        }
    },
    methods:{
        sengName(){
            // this.$bus.$emit('hello',this.name)
            pubsub.publish('hello',999)
        }
    }
}
</script>

<style scoped>
    .ppp{
        background-color: pink;
        padding:5px;
        margin-top: 30px;
    }
</style>